<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>KCMS</title>
<jsp:include page="../iframecommon.jsp"></jsp:include>


 <script type="text/javascript">
	$(document).ready(function() {
		
		$('#reportrange').daterangepicker({
			startDate: moment().subtract('days', 29),
			endDate: moment(),
			minDate: '10/20/2015',
			maxDate: '12/31/2016',
			dateLimit: { days: 60 },
			showDropdowns: true,
			showWeekNumbers: true,
			timePicker: false,
			timePickerIncrement: 1,
			timePicker12Hour: true,
			ranges: {
				'Today': [moment(), moment()],
				'Yesterday': [moment().subtract('days', 1), moment().subtract('days', 1)],
				'Last 7 Days': [moment().subtract('days', 6), moment()],
				'Last 30 Days': [moment().subtract('days', 29), moment()],
				'This Month': [moment().startOf('month'), moment().endOf('month')],
				'Last Month': [moment().subtract('month', 1).startOf('month'), moment().subtract('month', 1).endOf('month')]
			},
			opens: 'left',
			buttonClasses: ['btn btn-default'],
			applyClass: 'btn-small btn-primary',
			cancelClass: 'btn-small',
			format: 'MM/DD/YYYY',
			separator: ' to ',
			locale: {
				applyLabel: 'Submit',
				fromLabel: 'From',
				toLabel: 'To',
				customRangeLabel: 'Custom Range',
				daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr','Sa'],
				monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
				firstDay: 1
			}
		 },
		 function(start, end) {
		  console.log("Callback has been called!");
		  $('#reportrange span').html('选择的截止时间：'+end.format('YYYY-M-D'));
		  $("#duetime").attr("value",end.format('YYYY-M-D')+' 23:59:59');
		 }
	  );
	  //Set the initial state of the picker label
	  $('#reportrange span').html('选择的截止时间：'+ moment().format('YYYY-M-D'));
	  $("#duetime").attr("value",end.format('YYYY-M-D')+' 23:59:59');
	  
	  
	});
	</script>
	
<script src="js/demo-skin-changer.js"></script>  
<script src="js/jquery.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/jquery.nanoscroller.min.js"></script>
<script src="js/demo.js"></script>  
 
<script src="js/moment.min.js"></script>
<script src="js/daterangepicker.js"></script>
 
<script src="js/scripts.js"></script>
<script src="js/pace.min.js"></script>
 
 
 <script type="text/javascript">
      function myCheck()
      {
    	  
    	  var inputs = document.getElementsByName('checkbox');
    	  var isChecked = false;
    	  for (var i = 0, l = inputs.length; i < l; i++) {
    	      if (inputs[i].checked == true) {
    	          isChecked = true;
    	      }
    	  }
    	  if (!isChecked) {
    		alert('至少选择一个课程');
    	  	return false;
    	  	}
    	  
    	  
    	  if(document.form1.checkbox.length==0)
          {
           
          }
          if(document.form1.assignmentname.value=="")
          {
           alert("作业名称不能为空");
           document.form1.assignmentname.focus();
           return false;
          }
          if(document.form1.description.value=="")
          {
           alert("作业描述不能为空");
           document.form1.description.focus();
           return false;
          }
          if(document.form1.duetime.value=="")
          {
           alert("作业截止日期不能为空");
           document.form1.duetime.focus();
           return false;
          }
          
         
         return true;
        
      }
    </script>

</head>
<body>
<div class="col-lg-2"></div>
<div class="col-lg-8">
<div class="main-box">
<header class="main-box-header clearfix">
<h1>新建作业任务</h1>
</header>
<div class="alert alert-success">
<i class="fa fa-check-circle fa-fw fa-lg"></i>
如果需要为相同班级上传相同作业任务，请使用复选框
</div>
<form action="assignment_submitAssignmentTask" role="form" name="form1" onSubmit="return myCheck()">

<div class="alert alert-success">
<i class="fa fa-check-circle fa-fw fa-lg"></i>
请勾选选择上传的内容
<s:iterator value="cj" status="cid">
  <div class="chbox">
  <div class="checkbox checkbox-nice">
  <input type="checkbox" name="checkbox" id="<s:property value='sn'/>" value="<s:property value='sn'/>"></input>
  <label for="<s:property value='sn'/>">
    <s:property value="cid" />-<s:property value="csn" /> <s:property value="cname" /> <s:property value="week" />周  <s:property value="time" />节  在<s:property value="location" />教室
  </label>
  </div>
  </div>
</s:iterator>
</div>
<div class="form-group">
<input name="assignmentname" placeholder="作业名" class="form-control"/>
<textarea name="description" placeholder="作业任务描述" class="form-control"></textarea>

<div id="reportrange" class="pull-right daterange-filter">
<i class="icon-calendar"></i>
<span>请选择日期范围</span> <b class="caret"></b>
</div>

<input id="duetime" name="duetime" placeholder="截止时间" class="form-control" type="hidden"/>
<button type="submit" class="btn btn-success" >提交作业</button>
<button type="submit" class="btn btn-default">清空所填内容</button>
</div>
</form>

</div>
</div>
<div class="col-lg-2"></div>

<table>

</body>
</html>